/* window.hh
* This file is part of ncursesxx library
* Copyright (c) 2003,2004 by Stanislav Ievlev
*
* This file is covered by the GNU Library General Public License,
* which should be included with libncursesxx as the file COPYING.
*/
#ifndef NCURSESXX_WINDOW_HH__
#define NCURSESXX_WINDOW_HH__

#include <curses.h>

#include <ncurses/support.hh>

namespace ncurses
{
	/**
	 * generic interface to NCurses window,
	 * it's only a container with general functions,
	 * more powerfull interface with subwindows and moving  will be provided by Panel
	 * note: derived windows (and subwindows) 
	 * are unusable 'cause their separate single buffer with window, so I use only general windows ()
	 */
	class window
	{
	public:
		window();
		window(const window& other);
		window& operator=(const window& other);

		virtual ~window(); /**< clear all internal structures */

		virtual void resize(unsigned int w, unsigned int h); /**< change window size  */

		unsigned int width() const; /**< @return width of the window */
		unsigned int height() const; /**< @return height of the window */
		unsigned int x() const; /**< @return first coordinate of left-upper conner of the window */
		unsigned int y() const; /**< @return second coordinate of left-upper conner of the window */

		/**
		 * mark line of the window as needed to update
		 * @param num number of the line
		 * @param count number of the lines to touch
		 */
		void touch_line(int num, int count = 1);
		void commit(); /**< commit window changes to virtual screen */

		void set_scroll(bool res = false); /**< scroll window content or not */

		WINDOW *win() { return win_; } /**< @return pointer to internal structure */
	protected:
		void swap(window &other);
		counter counter_; /**< class owner's number */
	private:
		WINDOW *win_; /**< internal ncurses window structure */
	};
	
	/**
	 * copy window content from source to destination
	 */
	void copy(window& source,window& destination);

}

#endif
